layui.define([ 'form', 'laydate', 'table','applyAccountApi', 'layer'], function(exports) {
    var form = layui.form;
    var applyAccountApi = layui.applyAccountApi;
    var index = layui.index;
    var view = {
        init:function(){
	        Lib.initGenrealForm($("#updateForm"),form);
	        this.initSubmit();
        },
        showMessage:function(data){
            console.log("showMessage");
            var layer = layui.layer;
            var index = layer.open({
                title:'企业开户信息',
                move:false,
                type:2,
                area: ['600px', '400px'],
                closeBtn: 1,
                btn:"确定",
                btnAlign: 'c',
                content: '/cms/applyAccount/process.do?id='+data.id,
                yes: function(index, layero){
                    //do something
                    layer.close(index); //如果设定了yes回调，需进行手工关闭
                    Lib.closeFrame();
                }
            });
        },
        initSubmit:function(){
            var _this = this;
            $("#updateButton").click(function(){
                form.on('submit(form)', function(){
                    applyAccountApi.updateApplyAccount($('#updateForm'),function(data){
                       parent.window.dataReload();
                       Common.info("更新成功");
                       _this.showMessage(data);
                        // Lib.closeFrame();

                    });
                });
            });
            $("#updateButton-cancel").click(function(){
                Lib.closeFrame();
            });
        },

            
    }
    exports('edit',view);
	
});